From 1e66efe5169dfad9a0c62ba42fbf31ce977bf49e Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Tue, 19 Dec 2023 09:36:40 -0500 Subject: Use modal dialogs for expense creation & edition (#10) * First attemps at using route interception and modals * Remove route interception * Make it work * Use Vaul on small screens * Improve vaul --- .../@modal/expenses/[expenseId]/edit/page.tsx | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/app/groups/[groupId]/@modal/expenses/[expenseId]/edit/page.tsx (limited to 'src/app/groups/[groupId]/@modal/expenses/[expenseId]/edit') diff --git a/src/app/groups/[groupId]/@modal/expenses/[expenseId]/edit/page.tsx b/src/app/groups/[groupId]/@modal/expenses/[expenseId]/edit/page.tsx new file mode 100644 index 0000000..fb70f45 --- /dev/null +++ b/src/app/groups/[groupId]/@modal/expenses/[expenseId]/edit/page.tsx @@ -0,0 +1,26 @@ +import { ExpenseModal } from '@/app/groups/[groupId]/@modal/expense-modal' +import { ExpenseForm } from '@/components/expense-form' +import { getExpense, getGroup } from '@/lib/api' +import { Metadata } from 'next' +import { notFound } from 'next/navigation' + +export const metadata: Metadata = { + title: 'Edit expense', +} + +export default async function EditExpensePage({ + params: { groupId, expenseId }, +}: { + params: { groupId: string; expenseId: string } +}) { + const group = await getGroup(groupId) + if (!group) notFound() + const expense = await getExpense(groupId, expenseId) + if (!expense) notFound() + + return ( + + + + ) +} -- cgit v1.3